package com.wtu.alicloud.client.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

/**
 * Created by chenmx on 2019-05-21.
 */
@RestController
@RequestMapping(value = "/demo")
public class DemoController {

    @Autowired
    private WebClient.Builder webClientBuilder;
    @GetMapping(value = "/hello")
    public Mono<String> hello(){
        Mono<String> result = webClientBuilder.build()
                .get()
                .uri("http://alicloud-sentinel/hello?name=chenmx")
                .retrieve()
                .bodyToMono(String.class);
        return result;
    }
}
